﻿@model dynamic

@{
    ViewBag.Title = "新农合接口请求窗口";
    Layout = "~/Views/Shared/_Index.cshtml";

}
<style>
    #btn_clean {
        background-color: #fff;
        color: #00a9ea;
        font-weight: bolder;
    }
</style>
<form name="form1" autocomplete="off">
    <div class="panel panel-default">
        <div class="panel-heading navb-bg">
            Request
        </div>
        <div style="padding-right:20px;">
            <table class="form">
                <tr>
                    <th class="formTitle"><span class="required">*</span>Intferface：</th>
                    <td class="formValue">
                        <input type="text" class="form-control" id="txt_it" placeholder="S02" />
                    </td>
                    <td class="formValue">
                        <button type="button" class="btn btn-primary" id="btn_request" value="请求" style="width: 100px;">Send</button>
                        <button type="button" class="btn btn-primary" id="btn_clean" value="清除" style="width: 100px;">Clean</button>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle"><span class="required">*</span>BodyXml：</th>
                    <td class="formValue" colspan="2">
                        <textarea type="text" class="form-control" id="txt_body" rows="9" cols="20"></textarea>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="panel panel-default" style="margin-bottom: 0">
        <div class="panel-heading navb-bg">
            Response
        </div>
        <div style="padding: 2px;padding-right:20px;">
            <table class="form">
                <tr>
                    <th class="formTitle">ResponseXml：</th>
                    <td class="formValue">
                        <textarea type="text" class="form-control" id="txt_response" rows="14" cols="20"></textarea>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>

<script lang="javascript">
    $(function () {
        $("#btn_request").click(function () {
            $("#txt_response").val("");
            $.najax({
                url: "/Com/XnhInterfaceSend",
                data: { itn: $("#txt_it").val(), body: $("#txt_body").val() },
                type: "POST",
                dataType: "json",
                success: function (rep) {
                    $("#txt_response").val(rep.data);
                }
            });
        });
        $("#btn_clean").click(function () {
            $("#txt_it").val("");
            $("#txt_body").val("");
            $("#txt_response").val("");
        });
    });

    //回车事件绑定
    $(document).keyup(function (event) {
        if (event.keyCode === 13) {
            $("#btn_request").trigger("click");
        }
    });
</script>